<template>
  <!-- <Dialog v-model="dialogVisible" title="详情"> -->
    <Descriptions :data="detailData" :schema="allSchemas.detailSchema" >
      <template #title>
        <div class="titleBox">详情</div>
      </template>
      <template #mode="{ row }">
        <span>{{ {'1':'被动','0':'主动'}[row.mode] }}</span>
      </template>
    </Descriptions>
      <div style="text-align: center;">
      <el-button @click="setClose">关 闭</el-button>
    </div>
  <!-- </Dialog> -->
</template>
<script lang="ts" setup>
import * as mailboxAPI from '@/api/news/mailbox'
import { allSchemas } from './configuration.data'

defineOptions({ name: 'ConfigurationDetail' })
const emit = defineEmits(['setClose']) // 

const dialogVisible = ref(false) // 弹窗的是否展示
const detailLoading = ref(false) // 表单的加载中
const detailData = ref() // 详情数据

/** 打开弹窗 */
const open = async (id: number) => {
  dialogVisible.value = true
  // 设置数据
  detailLoading.value = true
  try {
    detailData.value = await mailboxAPI.getByIdmailServerConfig({id:id})
  } finally {
    detailLoading.value = false
  }
}
defineExpose({ open }) // 提供 open 方法，用于打开弹窗
const setClose=()=>{
  dialogVisible.value = false
  emit('setClose')
}
</script>
